package com.qczl.pme.controller.stb;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.qczl.core.controller.BaseController;
import com.qczl.model.Json;
import com.qczl.pme.service.MettingService;

/**
 * 会议控制器
 * @author SongR
 *
 */
@Controller
@RequestMapping(value="/stb/metting")
public class StbMettingController extends BaseController {
	Logger log = Logger.getLogger(this.getClass());

	@Autowired
	MettingService service;
	
	/**
	 * 添加会议记录
	 * @作者:SongR
	 * @版本:v1
	 * @日期:2017年9月19日 下午3:21:26
	 */
	@ResponseBody
	@RequestMapping(value="/add/v1",method={RequestMethod.GET,RequestMethod.POST})
	public Json addRecordV1(String stbno,String topicid,String [] typeid){
		Json j = new Json();
		try {
			Long mettingid = service.add(stbno,topicid,typeid);
			if(mettingid!=null){
				j.setMsg("成功添加会议记录！");
				j.setResult(mettingid);
			}else{
				j.setMsg("添加会议记录失败！");
				j.setState(500);
				j.setSuccess(false);
			}
		} catch (Exception e) {
			j.setSuccess(false);
			j.setMsg("添加会议记录接口异常！");
			log.error("添加会议记录接口异常！",e);
		}
		return j;
	}
	
	/**
	 * 开始会议
	 * @作者:SongR
	 * @版本:v1
	 * @日期:2017年9月25日 下午4:39:05
	 */
	@ResponseBody
	@RequestMapping(value="/start/v1",method={RequestMethod.GET,RequestMethod.POST})
	public Json startMettingV1(String stbno,String mettingid){
		Json j = new Json();
		try {
			String url = service.startMettingV1(stbno,mettingid);
			j.setResult(url);
		} catch (Exception e) {
		}
		return j;
	}
}
